package entity

import "github.com/jinzhu/gorm"

type User struct {
	*gorm.Model
	Username string
	Password string
	Role     string
	Avatar   string
}

func (u User) Get(db *gorm.DB, name string) (User, error) {
	var user User
	err := db.Where("username = ?", name).First(&user).Error
	return user, err
}
